<template>
  <div>
    <basic-table
      :table-title="tableTitle"
      :data-source="dataSource"
      :data-params="dataParams"
      :multiple-table="false"
      class="mt-4"
    >
      <template v-slot:chack="scope">
        <span style="color: #0087FE; cursor: pointer;" @click="changeStatus(scope.row)">
          查看
        </span>
      </template>
    </basic-table>

    <Modal
      :show="dialogVisible"
      :descriptions-info="descInfo"
      :descriptions-list="descriptionsList"
      @close="close"
    />
  </div>
</template>
<script>
import BasicTable from '@/components/BasicTable/index.vue'
import Modal from '@/components/Modal/Index'

import { getProfePerDetail, getProfessionals } from '@/api/project'

export default {
  name: 'BasicInfos',
  components: { BasicTable, Modal },
  props: {
    projectId: { type: String, default: '' }
  },
  data() {
    return {
      dialogVisible: false,
      dataSource: () => getProfessionals,
      dataParams: {},
      tableTitle: [
        {
          label: '人员姓名',
          value: 'PerName',
          show: true,
          type: 'text'
        },
        {
          label: '证件号码',
          value: 'PerCard',
          show: true,
          type: 'text'
        },
        {
          label: '所在单位',
          value: 'ComName',
          show: true,
          type: 'text'
        },
        {
          label: '参与审施工图审查合格书编号',
          value: 'CensorNum',
          show: true,
          type: 'text'
        },
        {
          label: '承担角色',
          value: 'WorkName',
          show: true,
          type: 'text'
        },
        {
          label: '详情',
          show: true,
          type: 'slot',
          slot: 'chack'
        }
      ],
      descriptionsList: {
        'CensorNum': '施工图审查合格书编号',
        'PerName': '人员姓名',
        'IdcardType': '人员证件号类型',
        'Idcard': '证件号',
        'ComName': '所在单位名称',
        'ComNum': '所在单位统一社会信用代码',
        'TechTitleLevel': '职称等级',
        'TechTitleMajor': '职称专业',
        'RegCerName': '注册类型级等级',
        'Major': '从事专业名称',
        'WorkerTitle': '承担角色'
      },
      descInfo: null
    }
  },
  created() {
    this.dataParams.projectId = this.projectId
  },
  methods: {
    close(v) {
      this.dialogVisible = v
    },
    //  查看
    changeStatus(v) {
      getProfePerDetail({
        id: v.Id,
        projectId: this.projectId
      }).then(res => {
        if (res.code === 200) {
          this.dialogVisible = true
          this.descInfo = res.data.detail
        }
      })
    }
  }
}
</script>

<style scoped>

</style>
